import React,{Component} from 'react'
import {HashRouter,Route,Switch} from "react-router-dom"
import App from './App'
import Admin from './admin'
import Login from './pages/login'
import Buttons from './pages/ui/buttons'
import Home from './pages/home'
import Nomatch from './pages/404'
export default class TRouter extends Component{
    render(){
        return (
            <HashRouter>
                <App>
                    <Route  path="/login" component={Login} />  
                    {/* 这里的箭头函数不需要加{},并且在外部router中不要写组件 */}
                    <Route  path="/admin"  render={()=>
                        <Admin>
                             <Switch>
                                <Route  path="/admin/home" component={Home} />  
                                <Route  path="/admin/ui/buttons" component={Buttons} />  
                                <Route  path="/admin/pages/404" component={Nomatch} />  
                                <Route  component={Nomatch} />  
                            </Switch> 
                        </Admin>
                    }/>
                </App>
            </HashRouter>
        )
    }
} 